#!/bin/sh
#
# rootfs-resize        Starts rootfs-resize.
#
rootfs_resize() {
	printf "\t Resize the rootfs: "

	RDEV=$(findmnt -n -o SOURCE /)
	/sbin/resize2fs ${RDEV}
	if [ $? -eq 0 ]
	then
		echo  "OK"
	else
		echo  "Failed"
		exit 1
	fi
	echo 0
}

start() {
	printf "Starting rootfs-resize: \n"
	rootfs_resize
}

stop() {
	printf "Stopping rootfs-resize: "
	echo "OK"
}
restart() {
	stop
	start
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart|reload)
		restart
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac
exit $?
